#include <stdio.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>

int main()
{
  int fd = open("bite", O_RDWR | O_CREAT, 0666);
  //if(fd < 0)
  //{
  //  return 1;
  //}
  //int ret = lseek(fd, 0, SEEK_SET);
  const char* data = "i like linux\n";
  write(fd, data, strlen(data));

  ssize_t ret = lseek(fd, 0, SEEK_SET);
  
  if(ret < 0)
  {
    return 1;
  }
  char buf[1024] = { 0 };
  read(fd, buf, 1024);
  printf("%s", buf);
  close(fd);

  return 0;
}
